package kr.co.happenstance.lib;

import java.net.URL;

import android.util.Log;
import kr.co.happenstance.C;
import kr.co.happenstance.http.HttpRequestor;
import kr.co.happenstance.lib.vo.LibResultVo;
import kr.co.happenstance.lib.vo.PayLogResultVo;

public class PaylogLib extends CommonLib {

	public LibResultVo list(String id, int currentPage) throws Exception{
		LibResultVo resultVo = null;
		
		try{
			httpRequestor =  new HttpRequestor(new URL(C.API_URL_PAYLOG_LIST));
			httpRequestor.addParameter("id", id);
			httpRequestor.addParameter("currentPage", Integer.toString(currentPage));
			
			resultVo = super.send(PayLogResultVo.class);
			
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return resultVo;
	}
	
	public LibResultVo insert(String id, int payAmount, String orderId, int consumeResponse) throws Exception{
		LibResultVo resultVo = null;
		
		try{
			httpRequestor =  new HttpRequestor(new URL(C.API_URL_PAYLOG_INSERT));
			httpRequestor.addParameter("id", id);
			httpRequestor.addParameter("payAmount", Integer.toString(payAmount));
			httpRequestor.addParameter("orderId", orderId);
			httpRequestor.addParameter("consumeResponse", Integer.toString(consumeResponse));
			
			resultVo = super.send(LibResultVo.class);
			Log.d(TAG, "["+resultVo.getResult()+"]");
			Log.d(TAG, "["+resultVo.getMessage()+"]");
			
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return resultVo;
	}
	
	
}
